// @ts-ignore
/* eslint-disable */
import { request } from 'umi';

/** 获取当前的用户 GET /api/currentUser */
export async function currentUser(options?: { [key: string]: unknown }) {
  return request<API.CurrentUser>('/api/admin/v1/user', {
    method: 'GET',
    ...(options || {}),
  });
  // { "name": "Serati Ma", "avatar": "https://gw.alipayobjects.com/zos/antfincdn/XAosXuNZyF/BiazfanxmamNRoxxVxka.png", "userid": "00000001", "email": "antdesign@alipay.com", "signature": "海纳百川，有容乃大", "title": "交互专家", "group": "蚂蚁金服－某某某事业群－某某平台部－某某技术部－UED", "tags": [{ "key": "0", "label": "很有想法的" }, { "key": "1", "label": "专注设计" }, { "key": "2", "label": "辣~" }, { "key": "3", "label": "大长腿" }, { "key": "4", "label": "川妹子" }, { "key": "5", "label": "海纳百川" }], "notifyCount": 12, "unreadCount": 11, "country": "China", "access": "admin", "geographic": { "province": { "label": "浙江省", "key": "330000" }, "city": { "label": "杭州市", "key": "330100" } }, "address": "西湖区工专路 77 号", "phone": "0752-268888888" }
  // return new Promise((resolve, reject) => {
  //   resolve({ status: 'ok', type: 'account', currentAuthority: 'admin' });
  // });
}
/*
 * 获取用户列表
 * */
export async function getUserList(options?: { [key: string]: unknown }) {
  return request<API.CurrentUserList>('/api/admin/v1/user-list', {
    method: 'GET',
    ...(options || {}),
  });
}

/** 此处后端没有提供注释 GET /api/notices */
export async function getNotices(options?: { [key: string]: unknown }) {
  return request<API.NoticeIconList>('/api/notices', {
    method: 'GET',
    ...(options || {}),
  });
}

/**
 * 创建楼盘
 */
export async function createEstate(options?: { [key: string]: unknown }) {
  return request<API.NoticeIconList>('/api/admin/v1/estate', {
    method: 'POST',
    ...(options || {}),
  });
}

/**
 * 删除楼盘
 */
export async function delEstate(options?: { [key: string]: unknown }) {
  return request<API.NoticeIconList>(`/api/admin/v1/estate/${options && options.id}`, {
    method: 'DELETE',
    ...(options || {}),
  });
}

/*
 * 获取楼盘列表
 * */
export async function getEstateList(options?: { [key: string]: unknown }) {
  return request<API.NoticeIconList>('/api/admin/v1/estate-list', {
    method: 'GET',
    ...(options || {}),
  });
}

/**
 * 根据ID修改楼盘信息
 */
export async function updateEstate(options?: { [key: string]: unknown }) {
  return request<API.CardDetail>(`/api/admin/v1/estate/${options && options.id}`, {
    method: 'PATCH',
    ...(options || {}),
  });
}

/**
 * 根据ID获取楼盘信息
 */
export async function getEstate(options?: { [key: string]: unknown }) {
  return request<API.NoticeIconList>(`/api/admin/v1/estate/${options && options.id}`, {
    method: 'GET',
    ...(options || {}),
  });
}

/**
 * 新增房型
 */
export async function createHouseType(options?: { [key: string]: unknown }) {
  return request<API.NoticeIconList>(`/api/admin/v1/house-type`, {
    method: 'POST',
    ...(options || {}),
  });
}

/**
 * 更新房型
 */
export async function updateHouseType(options?: { [key: string]: unknown }) {
  return request<API.NoticeIconList>(`/api/admin/v1/house-type/${options && options.id}`, {
    method: 'PATCH',
    ...(options || {}),
  });
}

/**
 * 更新房型
 */
export async function delHouseType(options?: { [key: string]: unknown }) {
  return request<API.NoticeIconList>(`/api/admin/v1/house-type/${options && options.id}`, {
    method: 'DELETE',
    ...(options || {}),
  });
}

/**
 * 创建tag
 */
export async function createTag(options?: { [key: string]: unknown }) {
  return request<API.NoticeIconList>(`/api/admin/v1/tag`, {
    method: 'POST',
    ...(options || {}),
  });
}

/**
 * 删除tag
 */
export async function delTag(options?: { [key: string]: unknown }) {
  return request<API.NoticeIconList>(`/api/admin/v1/tag/${options && options.id}`, {
    method: 'DELETE',
    ...(options || {}),
  });
}

/**
 * 获取tag
 */
export async function getTags(options?: { [key: string]: unknown }) {
  return request<API.NoticeIconList>(`/api/admin/v1/tag?estate_id=${options && options.id}`, {
    method: 'GET',
    ...(options || {}),
  });
}

/**
 * 查询图片记录
 */
export async function getImg(options?: { [key: string]: unknown }) {
  return request<API.NoticeIconList>(`/api/admin/v1/image`, {
    method: 'GET',
    ...(options || {}),
  });
}

/**
 * 创建图片记录
 */
export async function createImg(options?: { [key: string]: unknown }) {
  return request<API.NoticeIconList>(`/api/admin/v1/image`, {
    method: 'POST',
    ...(options || {}),
  });
}
/**
 * 删除
 */
export async function delImg(options?: { [key: string]: unknown }) {
  return request<API.BizResult<API.EffectData>>(`/api/admin/v1/image/${options && options.id}`, {
    method: 'DELETE',
    ...(options || {}),
  });
}
/**
 * 获取定位信息
 */
export async function getAddressList(options: { [key: string]: unknown } = {}) {
  return request<API.BizResult<API.AddressData[]>>(
    '/api/admin/v1/lbs/location-search',
    {
      method: 'GET',
      ...options,
    }
  )
}


export async function getUploadToken() {
  return request<API.BizResult<API.TokenData>>(
    '/api/admin/v1/upload/token'
  )
}


/**
 * 创建banner 
 */
 export async function createBanner(options?: { [key: string]: unknown }) {
  return request<API.BizResult<API.EffectData>>(`/api/admin/v1/banner`, {
    method: 'POST',
    ...(options || {}),
  });
}


/**
 * 获取banner列表
 */
export async function getBannerList(options?: { [key: string]: unknown }) {
  return request<API.NoticeIconList>(`/api/admin/v1/banner`, {
    method: 'GET',
    ...(options || {}),
  });
}

/**
 * 删除banner
 */
 export async function delBanner(options?: { [key: string]: unknown }) {
  return request<API.BizResult<API.EffectData>>(`/api/admin/v1/banner/1${options && options.id}`, {
    method: 'DELETE',
    ...(options || {}),
  });
}


